#include "stdafx.h"
#include "ConnectListener.h"


CConnectListener::CConnectListener()
{
}


CConnectListener::~CConnectListener()
{
}

void CConnectListener::OnAccept(int nErrorCode)
{
	if (WSAENETDOWN == nErrorCode) return;

	CFileReceiver* pRecver = new CFileReceiver;
	Accept(*pRecver);
	m_vctFileRecver.push_back(pRecver);
}

void CConnectListener::OnClose(int nErrorCode)
{
	if (0 != nErrorCode) return;

	for (vector<CFileReceiver*>::iterator it = m_vctFileRecver.begin();
		it != m_vctFileRecver.end(); ++it)
	{
		(*it)->Close();
		delete (*it);
	}
}

void CConnectListener::OnConnect(int nErrorCode)
{
	CAsyncSocket::OnConnect(nErrorCode);
}
